
cd "C:\Users\sertsios\Dropbox\LPSU replication package RFS\Replication\Log files\Main Tables"
clear
log using Table8.txt, text replace
 
***Commercialization
clear
cd "C:\Users\sertsios\Dropbox\LPSU replication package RFS\Data"
use LPSU_MainSample_Sep2024, replace
set matsize 10000
cd "C:\Users\sertsios\Dropbox\LPSU replication package RFS\Tables"

***Set of fixed effects
egen sic1year=group(sic1 year)
qui tabulate sic1year, generate(dsic1year)
egen month_post= group(month post)
qui tabulate month_post, generate(dmonth)
qui tabulate year_around_ipo, generate(deventyear)
 
***Columns 1-3 
**Subsidiaries 
 set more off
eststo:qui xtreg subs IPO deventyear2 deventyear3 deventyear4 deventyear5  dsic1year* dmonth* , fe cluster(id) 
outreg2 using Table_com2.xls, keep(IPO) sortvar(IPO IPO_high_self  IPO_small  IPO_Y) tex(frag) excel bdec(3) nocons label ///
 addtext(Firm FE, Yes, Event year FE, Yes, SIC x calendar year FE, Yes, IPO month x Post FE, Yes, Regression, OLS, Instrument,-) replace

set more off
eststo:qui xtivreg2 subs (IPO=instrument) deventyear2 deventyear3 deventyear4 deventyear5 dsic1year* dmonth* , fe first cluster(id) partial(deventyear2 deventyear3 deventyear4 deventyear5 dsic1year* dmonth*)
outreg2 using Table_com2.xls, keep(IPO) sortvar(IPO IPO_high_self  IPO_small  IPO_Y) tex(frag) excel bdec(3) nocons nor2 label ///
 addtext(Firm FE, Yes, Event year FE, Yes, SIC x calendar year FE, Yes,  IPO month x Post FE, Yes,Regression, Second stage,Instrument,Pre-IPO ret>0) 

set more off
eststo:qui xtivreg2 subs (IPO IPO_fin_dep_eu_hi   IPO_small_s IPO_Y IPO_high_self=instrument instrument_fin_dep_eu_hi instrument_small_s instrument_Y  instrument_high_self) ///
 deventyear2 deventyear3 deventyear4 deventyear5  dsic1year* dmonth*, fe first cluster(id) partial(deventyear2 deventyear3 deventyear4 deventyear5 dsic1year* dmonth*)
outreg2 using Table_com2.xls, keep(IPO IPO_fin_dep_eu_hi   IPO_small_s IPO_Y IPO_high_self ) sortvar(IPO IPO_fin_dep_eu_hi   IPO_small_s IPO_Y IPO_high_self) tex(frag) excel bdec(3) nocons nor2 label ///
 addtext(Firm FE, Yes, Event year FE, Yes, SIC x calendar year FE, Yes, IPO month x Post FE, Yes, Regression, Second stage,Instrument,Pre-IPO ret>0 & Interactions)  

esttab,   keep(IPO IPO_fin_dep_eu_hi IPO_small_s IPO_Y IPO_high_self) order(IPO IPO_fin_dep_eu_hi IPO_small_s IPO_Y IPO_high_self) ///
 label se b(%9.3f) se(%9.3f) nor2 star(* 0.1 ** 0.05 *** 0.01) addnotes(Firm FE, Yes, Event year FE, Yes, SIC x calendar year FE, Yes, IPO month x Post FE, Yes, Col 1: OLS; Col2 IV; Col 3, IV w interactions) 
 
eststo clear    
 
 ***Columns 4-6 
 **international
 set more off
eststo:qui xtreg internl IPO deventyear2 deventyear3 deventyear4 deventyear5  dsic1year* dmonth* , fe cluster(id) 
outreg2 using Table_com2.xls, keep(IPO) sortvar(IPO IPO_high_self  IPO_small  IPO_Y) tex(frag) excel bdec(3) nocons label ///
 addtext(Firm FE, Yes, Event year FE, Yes, SIC x calendar year FE, Yes, IPO month x Post FE, Yes, Regression, OLS, Instrument,-) 

set more off
eststo:qui xtivreg2 internl (IPO=instrument) deventyear2 deventyear3 deventyear4 deventyear5 dsic1year* dmonth* , fe first cluster(id) partial(deventyear2 deventyear3 deventyear4 deventyear5 dsic1year* dmonth*)
outreg2 using Table_com2.xls, keep(IPO) sortvar(IPO IPO_high_self  IPO_small  IPO_Y) tex(frag) excel bdec(3) nocons nor2 label ///
 addtext(Firm FE, Yes, Event year FE, Yes, SIC x calendar year FE, Yes,  IPO month x Post FE, Yes,Regression, Second stage,Instrument,Pre-IPO ret>0) 

set more off
eststo:qui xtivreg2 internl (IPO IPO_fin_dep_eu_hi   IPO_small_s IPO_Y IPO_high_self=instrument instrument_fin_dep_eu_hi instrument_small_s instrument_Y  instrument_high_self) ///
 deventyear2 deventyear3 deventyear4 deventyear5  dsic1year* dmonth*, fe first cluster(id) partial(deventyear2 deventyear3 deventyear4 deventyear5 dsic1year* dmonth*)
outreg2 using Table_com2.xls, keep(IPO IPO_fin_dep_eu_hi   IPO_small_s IPO_Y IPO_high_self ) sortvar(IPO IPO_fin_dep_eu_hi   IPO_small_s IPO_Y IPO_high_self) tex(frag) excel bdec(3) nocons nor2 label ///
 addtext(Firm FE, Yes, Event year FE, Yes, SIC x calendar year FE, Yes, IPO month x Post FE, Yes, Regression, Second stage,Instrument,Pre-IPO ret>0 & Interactions)   
 ***********************
 
esttab,   keep(IPO IPO_fin_dep_eu_hi IPO_small_s IPO_Y IPO_high_self) order(IPO IPO_fin_dep_eu_hi IPO_small_s IPO_Y IPO_high_self) ///
 label se b(%9.3f) se(%9.3f) nor2 star(* 0.1 ** 0.05 *** 0.01) addnotes(Firm FE, Yes, Event year FE, Yes, SIC x calendar year FE, Yes, IPO month x Post FE, Yes, Col 1: OLS; Col2 IV; Col 3, IV w interactions) 
 
eststo clear   
 
 ***Columns 7-9  
 **Acquisitions 
***
set more off
eststo:qui xtreg log_acquisition IPO deventyear2 deventyear3 deventyear4 deventyear5  dsic1year* dmonth* , fe cluster(id) 
outreg2 using Table_com2b.xls, keep(IPO) sortvar(IPO IPO_high_self  IPO_small  IPO_Y) tex(frag) excel bdec(3) nocons label ///
 addtext(Firm FE, Yes, Event year FE, Yes, SIC x calendar year FE, Yes, IPO month x Post FE, Yes, Regression, OLS, Instrument,-) replace

set more off
eststo:qui xtivreg2 log_acquisition (IPO=instrument) deventyear2 deventyear3 deventyear4 deventyear5 dsic1year* dmonth* , fe first cluster(id) partial(deventyear2 deventyear3 deventyear4 deventyear5 dsic1year* dmonth*)
outreg2 using Table_com2b.xls, keep(IPO) sortvar(IPO IPO_high_self  IPO_small  IPO_Y) tex(frag) excel bdec(3) nocons nor2 label ///
 addtext(Firm FE, Yes, Event year FE, Yes, SIC x calendar year FE, Yes,  IPO month x Post FE, Yes,Regression, Second stage,Instrument,Pre-IPO ret>0) 

set more off
eststo:qui xtivreg2 log_acquisition (IPO IPO_fin_dep_eu_hi   IPO_small_s IPO_Y IPO_high_self=instrument instrument_fin_dep_eu_hi instrument_small_s instrument_Y  instrument_high_self) ///
 deventyear2 deventyear3 deventyear4 deventyear5  dsic1year* dmonth*, fe first cluster(id) partial(deventyear2 deventyear3 deventyear4 deventyear5 dsic1year* dmonth*)
outreg2 using Table_com2b.xls, keep(IPO IPO_fin_dep_eu_hi   IPO_small_s IPO_Y IPO_high_self ) sortvar(IPO IPO_fin_dep_eu_hi   IPO_small_s IPO_Y IPO_high_self) tex(frag) excel bdec(3) nocons nor2 label ///
 addtext(Firm FE, Yes, Event year FE, Yes, SIC x calendar year FE, Yes, IPO month x Post FE, Yes, Regression, Second stage,Instrument,Pre-IPO ret>0 & Interactions)   

esttab,   keep(IPO IPO_fin_dep_eu_hi IPO_small_s IPO_Y IPO_high_self) order(IPO IPO_fin_dep_eu_hi IPO_small_s IPO_Y IPO_high_self) ///
 label se b(%9.3f) se(%9.3f) nor2 star(* 0.1 ** 0.05 *** 0.01) addnotes(Firm FE, Yes, Event year FE, Yes, SIC x calendar year FE, Yes, IPO month x Post FE, Yes, Col 1: OLS; Col2 IV; Col 3, IV w interactions) 
 
eststo clear  

 ***Columns 10-12   
**Target 
 set more off
eststo:qui xtreg target IPO deventyear2 deventyear3 deventyear4 deventyear5  dsic1year* dmonth* , fe cluster(id) 
outreg2 using Table_com2b.xls, keep(IPO) sortvar(IPO IPO_high_self  IPO_small  IPO_Y) tex(frag) excel bdec(3) nocons label ///
 addtext(Firm FE, Yes, Event year FE, Yes, SIC x calendar year FE, Yes, IPO month x Post FE, Yes, Regression, OLS, Instrument,-) 

set more off
eststo:qui xtivreg2 target (IPO=instrument) deventyear2 deventyear3 deventyear4 deventyear5 dsic1year* dmonth* , fe first cluster(id) partial(deventyear2 deventyear3 deventyear4 deventyear5 dsic1year* dmonth*)
outreg2 using Table_com2b.xls, keep(IPO) sortvar(IPO IPO_high_self  IPO_small  IPO_Y) tex(frag) excel bdec(3) nocons nor2 label ///
 addtext(Firm FE, Yes, Event year FE, Yes, SIC x calendar year FE, Yes,  IPO month x Post FE, Yes,Regression, Second stage,Instrument,Pre-IPO ret>0) 

set more off
eststo:qui xtivreg2 target (IPO IPO_fin_dep_eu_hi   IPO_small_s IPO_Y IPO_high_self=instrument instrument_fin_dep_eu_hi instrument_small_s instrument_Y  instrument_high_self) ///
 deventyear2 deventyear3 deventyear4 deventyear5  dsic1year* dmonth*, fe first cluster(id) partial(deventyear2 deventyear3 deventyear4 deventyear5 dsic1year* dmonth*)
outreg2 using Table_com2b.xls, keep(IPO IPO_fin_dep_eu_hi   IPO_small_s IPO_Y IPO_high_self ) sortvar(IPO IPO_fin_dep_eu_hi   IPO_small_s IPO_Y IPO_high_self) tex(frag) excel bdec(3) nocons nor2 label ///
 addtext(Firm FE, Yes, Event year FE, Yes, SIC x calendar year FE, Yes, IPO month x Post FE, Yes, Regression, Second stage,Instrument,Pre-IPO ret>0 & Interactions) 
  
esttab,   keep(IPO IPO_fin_dep_eu_hi IPO_small_s IPO_Y IPO_high_self) order(IPO IPO_fin_dep_eu_hi IPO_small_s IPO_Y IPO_high_self) ///
 label se b(%9.3f) se(%9.3f) nor2 star(* 0.1 ** 0.05 *** 0.01) addnotes(Firm FE, Yes, Event year FE, Yes, SIC x calendar year FE, Yes, IPO month x Post FE, Yes, Col 1: OLS; Col2 IV; Col 3, IV w interactions) 
 
eststo clear    


cd "C:\Users\sertsios\Dropbox\LPSU replication package RFS\Replication\Log files\Main Tables"
log close 
  